package com.flute.framework.autoprompt;

import com.flute.tools.data.DataRecord;

public class TokenData {
	private String text;
	  private String key;
	  private double[] priority;
	  private String updatedate;
	  private String recordOperator;

	public TokenData(int length) {
		this.priority = new double[length];
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public double[] getPriority() {
		return priority;
	}

	public void setPriority(double[] priority) {
		this.priority = priority;
	}

	public void updatePriority(double priority, int pos) {
		this.priority[pos] = priority;
	}

	public String getKey() {
		return key;
	}

	public void setKey(String key) {
		this.key = key;
	}

	public DataRecord toDataRecord() {
		DataRecord dr = new DataRecord();
		dr.AddField("key", getKey());
		dr.AddField("text", getText());
		for (int i = 0; i < getPriority().length; i++) {
			dr.AddField("priority" + i, String.valueOf(getPriority()[i]));
		}

		return dr;
	}

	public String getUpdatedate() {
		return updatedate;
	}

	public void setUpdatedate(String updatedate) {
		this.updatedate = updatedate;
	}

	public String getRecordOperator() {
		return recordOperator;
	}

	public void setRecordOperator(String recordOperator) {
		this.recordOperator = recordOperator;
	}
}
